-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc_typeck: remove the "preload all impls ever" workaround in coherence. #25323
Conversation
…ake it clear that it only populates inherent impls.
…rait's impls from all the crates.
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
@brson Any chance this can make it into 1.0? I don't mind it personally, but I've seen some interest on IRC for having the (minor IMO) compile-time wins here in 1.0. |
@eddyb, you're my hero 😻 |
@bors r+ |
📌 Commit 75cd8f9 has been approved by |
@bors p=5 |
(Regarding 1.0, I'm inclined to say the risk/reward here does not pay off; there are other lower risk PR's that also have UX impact that we declined much earlier in beta cycle) |
The loop to load all the known impls from external crates seems to have been used because `ty::populate_implementations_for_trait_if_necessary` wasn't doing its job, and solely relying on it resulted in loading only impls in the same crate as the trait. Coherence for `librustc` was reduced from 18.310s to 0.610s, from stage1 to stage2. Interestingly, type checking also went from 46.232s to 42.003s, though that could be noise or unrelated improvements. On a smaller scale, `fn main() {}` now spends 0.003s in coherence instead of 0.368s, which fixes #22068. It also peaks at only 1.2MB, instead of 16MB of heap usage.
Without reading too closely, this looks great to me, and I agree with @pnkfelix's assessment that this is not a good candidate for backporting. |
Nice, those are some serious speedups! Looks like 1.1 will already improve compile speed. |
The loop to load all the known impls from external crates seems to have been used because
ty::populate_implementations_for_trait_if_necessary
wasn't doing its job, and solely relying on it resulted in loading only impls in the same crate as the trait.Coherence for
librustc
was reduced from 18.310s to 0.610s, from stage1 to stage2.Interestingly, type checking also went from 46.232s to 42.003s, though that could be noise or unrelated improvements.
On a smaller scale,
fn main() {}
now spends 0.003s in coherence instead of 0.368s, which fixes #22068.It also peaks at only 1.2MB, instead of 16MB of heap usage.